﻿using System.IO;
using DesktopToy.Core.Common;
using YamlDotNet.Serialization;

namespace DesktopToyWpf.Services;

public class Config
{
    public static Config ReadConfig()
    {
        var deserializer = new DeserializerBuilder().Build();
        var yaml = File.ReadAllText(PathHelper.GetResourcePath("Config.yml"));
        return deserializer.Deserialize<Config>(yaml);
    }
    
    /// <summary>
    /// 高德Web服务的Key，此处使用的Key是作者本人测试使用的，随时可能失效，推荐大家去申请一个：https://lbs.amap.com/api/webservice/guide/api/weatherinfo
    /// </summary>
    public required string WebServiceApiKey { set; get; }
    
    /// <summary>
    /// 天气预报的adcode，参考项目根目录的 AMap_adcode_citycode.xlsx，或者到官网下载一份：https://lbs.amap.com/api/webservice/download
    /// </summary>
    public required int WeatherAdcode { set; get; }
}